﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace threadState
{
    internal class Ready : State
    {
        public Ready()
        {
            StateName = "就绪";
        }

        // 使线程从就绪状态进入运行状态
        public void GetCPU(Thread thread)
        {
            Console.Write($"ID 为 {thread.ThreadId} 的线程通过 GetCPU 操作已由");
            Console.Write($"{thread.CurrentState.StateName} 转为");
            thread.CurrentState = new Running();
            Console.WriteLine($"{thread.CurrentState.StateName}\n");
        }
    }
}
